C++ compilers: Be sane with standard libraries#85189
C++ compilers: Be sane with standard libraries#85189Ericson2314 merged 2 commits intoNixOS:stagingfrom
Conversation
|
Seeing that this is such a massive rebuild, on I am all ears on how we can do more nix and less bash to make the inevitable follow-up work easier. Maybe we could purely concat lists for all those |
25260c6 to
881d8cc
Compare
pkgs/top-level/all-packages.nix
Outdated
There was a problem hiding this comment.
We may need a migration or warning for this.
It may not be actively used though
There was a problem hiding this comment.
I am not sure what should be aliased?
There was a problem hiding this comment.
Not aliased but we need a throw statement in aliases.nix that generates a warning stating that this file has been removed.
There was a problem hiding this comment.
This may be used outside by wrappers outside of nixpkgs. might be worth keeping, but just as meta-information.
There was a problem hiding this comment.
It might be, but I think that's bad :)
There was a problem hiding this comment.
There's no good way to use libraries that want these c flags without some meta-info like this. For instance bindgen in rust or anything that uses libclang. If we're going to be removing it, we should at least have a replacement.
There was a problem hiding this comment.
Right I would rather have a more general way to get flags and just this one in particular. The default part (i.e. miy get overriden) is no good too.
There was a problem hiding this comment.
Maybe we should just expose all of these flags in the cc-wrapper ? Something like stdenv.cc.cflags_compile and stdenv.cc.ld_flags
There was a problem hiding this comment.
that is the pre-substituted values since we don't know the actual values at evaluation
There was a problem hiding this comment.
It would be nice to uses more Nix so we did know the values. (e.g. have a nix boolean and then assert at run-time it was correct.)
There was a problem hiding this comment.
I think that requires Nix-level setup-hooks to work correctly. I think that might be too ambitious for now.
There was a problem hiding this comment.
I'm thinking something like /nix-support/get-cflags.sh which does all of this for you.
There was a problem hiding this comment.
Well getting all the -I flags for other packaged requires that, but not just the std library stuff I think.
There was a problem hiding this comment.
Right these should just need the basic c/c++ headers and library paths.
9427d9c to
de07048
Compare
|
I think we can also remove some of the old hacks like in https://github.com/NixOS/nixpkgs/pull/26709/files too |
|
Does that change here? I would expect this to still only include it for clang++. Come to think of it, wouldn't |
There was a problem hiding this comment.
Would it make sense to expose the libc++ of the compiler, similar to libc?
There was a problem hiding this comment.
Yeah, though null for libstdc++ is rather unfortunate. Oh well, all the more reason to get on splitting up the GCC derivation.
There was a problem hiding this comment.
Perhaps for now cc.libcxx = gcc would make sense? Maybe that could also solve cc ? gcc.
There was a problem hiding this comment.
I'm on the fence about this---I do want to get rid of cc.gcc but it's a bit disingenous unless we can somehow filter the other libraries out. Maybe we can leave that for a follow-up PR?
Yeah, you're right - I was forgetting what the issue was there. We still need CXX to be used. |
a7808ca to
995989a
Compare
995989a to
604b60d
Compare
|
OK with the last push I have both |
|
We also have some tools that consume the c/c++ standard includes: cquery, clang-tools and ccls |
604b60d to
a385085
Compare
eba5f1f to
9e62a88
Compare
9e62a88 to
f3f7612
Compare
As it turns out those are not affected by this change. I removed cquery last week. Clangd and CCLS only take the libcxx include path as input. I remember to use |
|
OK, it evals! I don't think we need any more back-compat stuff ATM, but happy to add things in requested. |
NIX_CXXSTDLIB_COMPILE has been removed in NixOS#85189 and NixOS#85189 (comment) remommends using the files in ${clang}/nix-support to find the correct flags to pass to libclang.
Motivation for this change
This is long overdue, @LnL7 Time for you to say "I told you so!" :).
CC @matthewbauer @TravisWhitaker
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)